package stark.app.function.vplayer;

import com.stark.picselect.config.PhotoConfig;
import com.stark.video.player.VideoPlayerActivity;
import com.stark.video.player.VideoPlayerEntry;

import stark.app.MediaSelectUtil;
import stark.app.R;
import stark.app.databinding.ActivityVideoPlayerDemoBinding;
import stark.common.basic.base.BaseNoModelActivity;

/**
 * Author：daizhongbin on 2021/9/2
 * Email：1027154338@qq.com
 * Desc:
 */
public class VideoPlayerDemoActivity extends BaseNoModelActivity<ActivityVideoPlayerDemoBinding> {
    @Override
    protected int onCreate() {
        return R.layout.activity_video_player_demo;
    }

    @Override
    protected void initView() {
        mDataBinding.btnDefConfig.setOnClickListener(v -> {
            MediaSelectUtil.pickMedia(this, PhotoConfig.Mode.VIDEO, 1, data -> {
                if (data == null || data.size() == 0) {
                    return;
                }
                VideoPlayerEntry.enterVideoPlayer(this, data.get(0).getTargetPath(), null);
            });
        });
        mDataBinding.btnConfig1.setOnClickListener(v -> {
            MediaSelectUtil.pickMedia(this, PhotoConfig.Mode.VIDEO, 1, data -> {
                if (data == null || data.size() == 0) {
                    return;
                }
                VideoPlayerActivity.UiConfig config = new VideoPlayerActivity.UiConfig();
                config.topRightViewTxt = "保存";
                config.showBottomBtns = false;
                VideoPlayerEntry.enterVideoPlayer(this, data.get(0).getTargetPath(), config);
            });
        });
        mDataBinding.btnConfig2.setOnClickListener(v -> {
            MediaSelectUtil.pickMedia(this, PhotoConfig.Mode.VIDEO, 1, data -> {
                if (data == null || data.size() == 0) {
                    return;
                }
                VideoPlayerActivity.UiConfig config = new VideoPlayerActivity.UiConfig();
                config.pageTitle = "视频播放";
                config.showBottomBtns = false;
                VideoPlayerEntry.enterVideoPlayer(this, data.get(0).getTargetPath(), config);
            });
        });
    }

    @Override
    protected void initData() {

    }
}
